package com.uw.scenic.config.enrukaserver;


import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.List;

/**
 * 定制http消息转换器
 * 和视频不一样，视频是实现了WebMvcConfigurer，可能是因为springmvc版本的不同
 */
@Configuration
public class WebConfiguration extends WebMvcConfigurerAdapter {

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        converters.clear();
        //转换为application/json
        converters.add(new MappingJackson2HttpMessageConverter());
    }

}
